package com.fan.play.manager

import android.app.Activity
import java.util.Stack

object ActivityStack {

    private val stack = Stack<Activity>()

    fun add(activity: Activity) {
        stack.add(activity)
    }

    fun remove(activity: Activity) {
        stack.remove(activity)
    }

    fun top(): Activity {
        if (stack.size == 0)
            throw ArrayIndexOutOfBoundsException("size is 0")
        return stack.lastElement()
    }
}